package logic

import (
	"context"
	"user_srv/internal/dao"
	"user_srv/internal/svc"
	"user_srv/user"

	"github.com/zeromicro/go-zero/core/logx"
)

type MembershipLevelAddLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewMembershipLevelAddLogic(ctx context.Context, svcCtx *svc.ServiceContext) *MembershipLevelAddLogic {
	return &MembershipLevelAddLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

// 会员等级添加
func (l *MembershipLevelAddLogic) MembershipLevelAdd(in *user.MembershipLevelAddRequest) (*user.MembershipLevelAddResponse, error) {
	dao.MembershipLevelAdd(in.Name, int32(in.Grade), in.Description)
	return &user.MembershipLevelAddResponse{
		Msg: "用户等级添加成功",
	}, nil
}
